package reno.eureka.timecycle.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reno.eureka.timecycle.entity.CycleMO;
import reno.eureka.timecycle.entity.EarthExplainMO;
import reno.eureka.timecycle.entity.PersistentCycleMO;

@RestController
public class EarthController {

    @RequestMapping("/getEarthCycle")
    public String getCetusCycle() {
        CycleMO cycleMO = PersistentCycleMO.getInstance().getEarthCycle();
        EarthExplainMO earthExplainMO = new EarthExplainMO(cycleMO);

        String response = "[CURRVAL]，距离[NEXTVAL]还有[TIME]";
        response = response.replace("[CURRVAL]", earthExplainMO.getCurrval());
        response = response.replace("[NEXTVAL]", earthExplainMO.getNextval());
        response = response.replace("[TIME]", earthExplainMO.getTimeString());
        String responseHead = "【测试版本】指挥官，Ordis检测到当前地球时间\n";
        return responseHead + response;
    }

}
